import java.util.List;
import java.util.Scanner;
/*
    通过学号去查找学生，打印学生的信息
 */
public class SearchStudents {
    public SearchStudents() {
    }
    public static void search(List<Student> list) {
        //boolean b = true;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入学生学号查询学生信息:");
        String s = sc.nextLine();
        for (Student student : list) {

            if (student.getId().equals(s)) {

                System.out.println("学生姓名：" + student.getName() + " "
                        + "年龄" + student.getAge());

            } else {
                System.out.println("对不起，不存在该学号的学生");
            }
        }

    }
}
